﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DalatCooking.Core;
using DalatCooking.Core.Helper;

public partial class admin_Settings_HeadTrack : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txtHtmlHeader.Text = Setting.String("SITE_METADESC");
            txtKeywords.Text = Setting.String("SITE_METAKEYWORD");
            txtTrackingScript.Text = Setting.String("SITE_TRACKING");
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Setting.SetValue("SITE_METADESC", txtHtmlHeader.Text);
        Setting.SetValue("SITE_METAKEYWORD", txtKeywords.Text);
        Setting.SetValue("SITE_TRACKING", txtTrackingScript.Text);
        Response.Redirect(Request.RawUrl);
    }
    protected override void OnInit(EventArgs e)
    {
        if (!IsPostBack)
        {
            Person p = Session.GetPersonLogged();
            if (!p.IsInRole("SuperUser"))
                Response.Redirect("/admin/accessdeny.aspx");
        }
        base.OnInit(e);
    }
}